﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class useractivate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string id = Request.QueryString["id"];
            //webservice que envia id para activar us
            string respuesta = "1";
            com.bpophotos.www.Service service= new com.bpophotos.www.Service();
            string user= service.getTodosDatosUsuario(id);
            rUser re = Utility.getRUser(user);

           // respuesta= service.ActivateUser(id);
            if (respuesta.Equals("1")) {
                string body = "<table width=\"500\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#666666\"><tr><td colspan=\"2\" bgcolor=\"#000000\" color: \"#FFFFFF\"><h1>New  Registration</h1></td></tr>";
                body = body + "<tr><td colspan=\"2\">A new client is Active on bpophotos.com</td></tr>";
                  body = body + "<tr><td> User ID</td><td> " + id + "</td></tr>";
                  body = body + "<tr><td> First Name </td><td> " + re.getNombre() + "</td></tr>";
                  body = body + "<tr><td> Last Name </td><td> " + re.getApellido() + "</td></tr>";
                  body = body + "<tr><td> Email </td><td> " + re.getEmail() + "</td></tr>";
                  body = body + "<tr><td> Group </td><td> " + re.getGroup() + "</td></tr>";


                  string from = "signup@bpophotos.com";
                string to = "newclient@bpophotos.com";
                Utility.sendMail(from, to, "New Sign Up on bpophotos.com", body,"");
               
                
            }

        
                
                
              
            

        }catch (Exception ex)
        {
            Response.Redirect("Default.aspx");
        
        }
        Response.Redirect("Thanks.aspx");
    }
    private string crearXml(string id)
    {
        string sxml = "";
        sxml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <datos_activacion><userid>";
        sxml = sxml + id.ToString();
        sxml = sxml + "</userid>";
        sxml = sxml + "</datos_activacion>";
       
        return sxml;
    }
}
